<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script src="js/js/jquery.min.js"></script>
	</head>
	<body>
		<div>商品的编号:<span id="itmeid"></span></div>
		<div>商品的价格:<span id="itmeprice"></span></div>
	</body>
	<script>
		//jquery提供ajax，参数是一个js对象{}
		$.ajax({
			type:"POST",
			url:"https://p.3.cn/prices/mgets?skuIds=J_100008348542",
			data:{
				"skuIds":"J_100008348542"
			},
			contentType:"application/json;charset=utf-8;",
			dataType:"jsonp",
			success:function(data){
				console.log("访问成功")
				console.log("data")
				
				var item= data[0];
				
				var itemid=item.id;
				var itemprice=item.p;
				console.log(itemid);
				console.log(itemprice);
				
				var id=$("#itmeid");
				id.text(itemid);
				id.css("color","blue")
				
				var price=$("#itmeprice");
				price.text(itemprice);
				price.css("color","red")
			},
			error:function(e){
				console.log("访问失败")
				jsonstr.log("")
			}
		})
	</script>
</html>

